<%@ page language="java" contentType="text/html;charset=UTF-8"
   	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<script language='javascript' src='javascript/MultiAction.js'></script>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<form name ='ViewAllFile' action="view_all_files.html" method="post">
<table cellpadding="0" cellspacing="0" width="690" align="center" border="0">
		<tr>
			<td align="left" colspan="3">
			áž”áž„áŸ’áž áž¶áž‰áž¯áž€ážŸáž¶ážšáž�áž¶áž˜áž”áŸ’ážšáž—áŸ�áž‘&nbsp;:
			<select name="txtcat" onchange="javascript:document.forms['ViewAllFile'].submit();">
				<option value="0">All Categories</option>
				<c:forEach var="y" begin="0" end="${fn:length(categories)-1 }" step="1" varStatus="status">
					<c:choose>
						<c:when test="${categories[y].CATEGORY_ID==curcategory}">
							<option selected="selected" value="${categories[y].CATEGORY_ID}">
								<c:out value="${categories[y].CATEGORY_NAME}"></c:out>
							</option>
						</c:when>
						
						<c:otherwise>
							<option value="${categories[y].CATEGORY_ID}">
								<c:out value="${categories[y].CATEGORY_NAME}"></c:out>
							</option>
						</c:otherwise>
					</c:choose>
				</c:forEach>
			</select>
		</tr>
		<tr><td colspan="6" height="8"> </td></tr>
	<tr class="viewfileheader" align="center">
		<td width="6%" height="25">áž›áŸ�áž�ážšáŸ€áž„</td>	
		<td width="30%">áž…áŸ†ážŽáž„áž‡áž¾áž„</td>	
		<td width="35%">áž”ážšáž·áž™áž¶áž™</td>	
		<td width="10%">áž‘áŸ†áž áŸ†</td>
		<td width="10%">áž‘áž¶áž‰áž™áž€</td>
	</tr>
	<%
		String bgcolor="#EEE";
	%>
	<c:if test="${fn:length(data)>0}">
		<c:forEach var="x" begin="0" end="${fn:length(data)-1}" step="1" varStatus ="status">
			<%
				bgcolor=(bgcolor=="#EEE")?"#FFF":"#EEE";
			%>
				<c:if test="${x>=StartingRow && x<=EndingRow}">
					<tr bgcolor="<%=bgcolor%>" align="center">
						<td height="40" style="border-left:solid 1px #DDD; border-bottom:solid 1px #DDD;"><c:out value="${x+1}"/></td>
						<td align="center" style="border-left:solid 1px #DDD; border-bottom:solid 1px #DDD;">&nbsp;<a href="view_file_detail.html?file_id=${data[x].FILE_ID}"><c:out value="${data[x].FILE_TITLE}"/></a></td>
						<td align="center" style="border-left:solid 1px #DDD; border-bottom:solid 1px #DDD;padding-right: 4px; padding-left: 4px;">
							<c:choose>
								<c:when test="${fn:length(data[x].FILE_DESC)>=80}">
									<c:out value="${fn:substring(data[x].FILE_DESC,0,80)}"/>...
								</c:when>
								<c:otherwise>
									<c:out value="${data[x].FILE_DESC}"/>
								</c:otherwise>
							</c:choose>
						</td>
						<td style="border:solid 1px #DDD; border-top:solid 0px #DDD;"><c:out value="${data[x].FILE_SIZE} MB"></c:out></td>
						<td style="border-right:solid 1px #DDD; border-bottom:solid 1px #DDD;"><a href="${ServerURL}${data[x].FILE_PATH}${data[x].FILE_NAME}"><img src="images/Download.png"></a></td>
					</tr>
				</c:if>
		</c:forEach>
	</c:if>
	<c:if test="${fn:length(data)<=0}">
		<tr>
			<td align="center" colspan="5" height="30" valign="bottom"> No file was uploaded</td>
		</tr>
	</c:if>
	<tr><td colspan="8" >&nbsp;</td></tr>
	<tr>
		<td height="30" valign="middle" colspan="8" align="center">
		<c:if test="${PageCount>1}">
			<c:if test="${page>1}">
				<a href="view_all_files.html?page=${page-1}">áž”áž€áž€áŸ’ážšáŸ„áž™</a>
			</c:if>
			<c:if test="${page<=1}">
				<label style="color: #333">áž”áž€áž€áŸ’ážšáŸ„áž™</label>
			</c:if>
			&nbsp;
				<c:forEach var="i" begin="1" end="${PageCount}" step="1" varStatus ="status">
					<c:if test="${i==page}">
						<label style="color: #333; width: 25px; height: 10px; border: solid 1px;">&nbsp;<c:out value="${i}" />&nbsp;</label>
					</c:if>
					<c:if test="${i!=page}">
						<a href="view_all_files.html?page=${i}" style="width: 25px; height: 10px;  border: solid 1px #CCC;">&nbsp;<c:out value="${i}" />&nbsp;</a>
					</c:if>
				</c:forEach>
			&nbsp;	
			<c:if test="${page<PageCount}">
				<a href="view_all_files.html?page=${page+1}">áž‘áŸ…áž˜áž»áž�</a>
			</c:if>
			<c:if test="${page>=PageCount}">
				<label style="color: #333">áž‘áŸ…áž˜áž»áž�</label>
			</c:if>
		</c:if>
		</td>
	</tr>

</table>
</form>
</body>
</html>